# Alexander F. Gazmararian
# afg2@princeton.edu
# January 9, 2024

#Purpose: estimate percent of residents who view gas power plant in their community

#Load packages
library(tidyverse)
library(modelsummary)
library(here)

#Load data
g <- readRDS(here("data", "inter", "fairsurveys", "fairsurvey_2023.rds"))
#Proportion who see gas
prop.table(table(g$seegas))
#Create sample description
tab_samp <- here("output", "tables", "si_tab_fair_visibility.txt")
datasummary(
  (Age = age) + (Female = female) + (`Non-White` = nonwhite) + (College = college) + (`Coal Household` = coal) + (Employed = employfull) + (Democrat = dem) + (Republican = rep) ~ Mean + SD + Min + Max,
  data = g,
  fmt = 2,
  output = "latex"
) %>%
  cat(., file = tab_samp)
tab_samp_out <- readLines(tab_samp, warn = FALSE)
cat(tab_samp_out[-c(1,17)], file = tab_samp)
